﻿/*  Kiva.NET
 *  Copyright (c) 2009 Arun Kumar 
 *  middleforce@gmail.com
 */
using System;
using System.Xml.Linq;

namespace KivaLibrary
{
    public static class Parser
    {
        public static string ParseString(XElement inXML)
        {
            if (inXML == null)
            {
                return "";
            }
            else
            {
                return inXML.Value + "";
            };
        }
        public static double ParseDouble(XElement inXML)
        {
            try
            {
                if (inXML == null)
                {
                    return 0;
                }
                else
                {
                    return double.Parse(inXML.Value + "");
                }
            }
            catch (Exception)
            {

                return 0;
            }
        }
        public static int ParseInteger(XElement inXML)
        {
            try
            {
                if (inXML == null)
                {
                    return 0;
                }
                else
                {
                    return int.Parse(inXML.Value + "");
                }
            }
            catch (Exception)
            {

                return 0;
            }
        }
    }
}
